	
	function UI_ZharaIbe() {};
	
	/* Hotel Booking Validations */
    UI_ZharaIbe.validateHotelBooking = function () {
        if (objSelHtl.value == "") {
            alert("Please Select the City or Hotel");
            return false;
        }
		
		var DateToValue = $("#txtHtlRDay").val();
		var DateFromValue = $("#txtHtlDDay").val();
		var MaximumBookingNights = 14;		
		
		var days = calculateDateDiffRange(DateFromValue, DateToValue);	
		
		if ( days <= 0) {
			alert("Check out date should be greater than Check in Date");
			return false;
		}
		
		if ( days > MaximumBookingNights) {
			alert("Maximum amount of booking nights is 14");
			return false;
		}
				
		var sglRoomsVal = $("#selRoomSgl").val();
		var dblRoomsVal = $("#selRoomDbl").val();
		var tplRoomsVal = $("#selRoomTpl").val();
		var sglRooms = parseInt(sglRoomsVal);
		var dblRooms = parseInt(dblRoomsVal);
		var tplRooms = parseInt(tplRoomsVal);
		var ibeMaximumNoOfRooms = 8;
		
		if( (sglRooms + dblRooms + tplRooms) == 0 ){
			alert("Please select number of rooms");
			return false;
		}
				
		if( (sglRooms + dblRooms + tplRooms) > ibeMaximumNoOfRooms ){
			alert("You can select maximum " + ibeMaximumNoOfRooms + " number of rooms");
			return false;
		}

        return true;
    }
	
	/* get the difference days between two dates */
	function calculateDateDiffRange(strFromDate, strToDate){
		var date1 = StringToDate(strFromDate);
		var date2 = StringToDate(strToDate);
		var sec = date2.getTime() - date1.getTime();
		if (isNaN(sec)){
			return "";
		}
		if (sec < 0){
			return "";
		}

		var second = 1000, minute = 60 * second, hour = 60 * minute, day = 24 * hour;

		var days = Math.floor(sec / day);
		sec -= days * day;
		var hours = Math.floor(sec / hour);
		sec -= hours * hour;
		var minutes = Math.floor(sec / minute);
		sec -= minutes * minute;
		var seconds = Math.floor(sec / second);

		return days;
	}
	
	UI_ZharaIbe.dateChaned = function () {
		
		var DateToValue = $("#txtHtlRDay").val();
		var DateFromValue = $("#txtHtlDDay").val();
		var dateDif = calculateDateDiffRange(DateFromValue, DateToValue);
		
		$('#noOfNights').val(dateDif);
	}
	
	UI_ZharaIbe.noOfNightsChaned = function () {
		
		var DateToValue = $("#txtHtlDDay").val();
		var depDate = StringToDate(DateToValue);
		//parseInt
		var noOfNights = $('#noOfNights').val();
		var newRtnDate = DateToString(addDays(depDate, noOfNights));
		$("#txtHtlRDay").val(newRtnDate);
		// set the check out date
		UI_Widget.dateChangeFlt(3);
	}
	
	/* Build Hotel Booking Data*/
    UI_ZharaIbe.buildHotelBookingData = function () {
		
		strCityId = "";
		strHotelId = "";
		for(dataObj in objSelHtl.dataArray){
			if(objSelHtl.text == objSelHtl.dataArray[dataObj][1]){
				strCityId = objSelHtl.dataArray[dataObj][2];
				
				if(objSelHtl.dataArray[dataObj][3]!=""){
					strHotelId = objSelHtl.dataArray[dataObj][3];
					//alert(objSelHtl.dataArray[dataObj][3]);
				}
				break;
			}
		}
		
		var strOccupancies = "";
		var sglRooms = $("#selRoomSgl").val();
		var dblRooms = $("#selRoomDbl").val();
		var tplRooms = $("#selRoomTpl").val();
		
	
		for (i=0;i<sglRooms;i++) {
				strOccupancies += "1-0,";
		}

		for (i=0;i<dblRooms;i++) {
				strOccupancies += "2-0,";
		}
		
		for (i=0;i<tplRooms;i++) {
				strOccupancies += "3-0,";
		}
		
		if(strOccupancies.length>0 && strOccupancies.charAt(strOccupancies.length-1)==","){
			strOccupancies = strOccupancies.substring(0,strOccupancies.length-1);
		}
		
        var strHdnData = "";
        strHdnData += "cityId=" + strCityId;
        strHdnData += "&cityName=" + objSelHtl.text;
		
		strHdnData += "&hotelId=" + strHotelId;
        strHdnData += "&checkInDate=" + $("#txtHtlDDay").val();
        strHdnData += "&checkOutDate=" + $("#txtHtlRDay").val();
        strHdnData += "&currencyCode=" + $("#selCurrency").val();
		strHdnData += "&occupancies=" + strOccupancies;
		strHdnData += "&starRatingId=0";
		
		UI_Widget.strDataHospitality = strHdnData;
		
       // $("#hdnData").val(strHdnData);
       // $("#hdnMode").val("MB");
    }